

let ctx   = canvas.getContext('2d')




/**
 * 游戏主函数
 */
export default class Main {
  constructor() {
    console.log('game start ...')
    this.restart();
	this.bindLoop     = this.loop.bind(this);
  }

  

  restart() {
   
    canvas.addEventListener((
      'touchstart',
      function(e) {
        e.preventDefault()
   
        console.log('touched ... ');
      
     }
    ));

  }

  // 实现游戏帧循环
  loop() {

    console.log('loop ...');
	window.requestAnimationFrame(
      this.bindLoop,
      canvas
    )
  }
}
